{__NOLAYOUT__}
<layout name="no_nav" />

<!-- TOPBAR -->
<header class="top-bar flex-row">
  <a class="row-item row-item-auto top-bar-back" href="javascript:window.history.back()">返回</a>
  <h3 class="row-item top-bar-name">礼品订单</h3>
  <a class="row-item row-item-auto top-bar-menu" href="{$config.url}">主页</a>
</header>

<form action="__CONTROLLER__/receiveGiftsPost" method="post">
  
  <!-- 收货地址 -->
  <section class="pr-order-item pr-order-address">

    <a class="db" href="{:U('DisShopDeliverAddress/deliverAddressList','sid='.$sid)}?buyUrl={$buyUrl}">

      <empty name="order.address">
      <p>增加收货地址</p>
      <else />
      <p>{$order.address.provinceName}&nbsp;{$order.address.cityName}&nbsp;{$order.address.areaName}&nbsp;{$order.address.address}</p>
      <p>{$order.address.name}&nbsp;&nbsp;{$order.address.tel}</p>
      </empty>
      
    </a>

  </section>
  
  <!-- 商品清单 -->
  <section class="pr-order-item pr-good-list">

    <h5 class="pr-good-list-title">商品清单：共&nbsp;{:count($order['orderItems'])}&nbsp;件商品</h5>
    
    <section class="pr-good-list-container">
      <volist name="order.orderItems" id="vo">
      <volist name="vo.items" id="vo_attr">
      <div class="pr-good-item flex-row">
        <a class="pr-good-pic row-item row-item-3" href="javascript:;">
          <img src="{:getImageUrl($vo_attr['productPic'], 'small')}">
        </a>
        <div class="pr-good-info row-item row-item-7">
          <p>{$vo.productName}</p>
          <notempty name="vo_attr['productAttr']">
          <p>规格：{$vo_attr['productAttr']}</p>
          </notempty>
          <p>
            <span data-subprice="{$vo_attr.productPrice}">单价：{$vo_attr.productPrice}元</span>
            <span>数量：{$vo_attr.productNumber}</span>
          </p>
        </div>
      </div>
      </volist>
      </volist>
    </section>

  </section>
  
  <section class="pr-order-item">
    <p class="pr-order-money">
      <span>商品总金额</span>
      <span class="fr">￥{$order['goods_amount']}元</span>
    </p>
    <p class="pr-order-money">
      <span>运费</span>
      <span class="fr" id="freight">{$order['shipping_fee']}元</span>
    </p>
    <p class="pr-order-money total">
      <span>订单总计</span>
      <span class="fr" id="total-price">￥{$order['goods_amount']+$order['shipping_fee']}元</span>
    </p>
	
	<if condition="in_array('share', $order['operates'])">
    	<button type="submit" class="btn btn-orange w100 pr-btn">确认收礼</button>
    <else/>
    	<button type="button" class="btn btn-orange w100 pr-btn" disabled="disabled" >已结束</button>
    </if>

  </section>

  <input type="hidden" name="addressId" value="{$order.address.id}">
  <input type="hidden" name="id" value="{$order.id}">
  <input type="hidden" name="sid" value="{$sid}">
  
</form>

<script type="text/javascript">

  $(function(){

    $(".pr-good-list-title").on("tap", function(){
      $(this).parent().toggleClass("open");
    });

  });
</script>